import request from '@/utils/request';
import { setToken } from '@/utils/token-util';

//新增 “摄像头套餐”
export async function saveCamera (data) {
  const res = await request.post('/business/cameraPackage/add', data)
  if (res.data.code === 2000) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

//分页查询 “摄像头套餐”
export async function queryCamera (data) {
  const res = await request.post('/business/cameraPackage/page', data)
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}


//非分页查询 “摄像头套餐”_oem
export async function queryCameraLists (data) {
  const res = await request.post('/business/cameraPackage/selectList', data)
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

//修改 “摄像头套餐”——暂未使用 monitoringAge 是之前的api
export async function updateCamera (data) {
  const res = await request.post('/business/monitoringAge/update', data)
  if (res.data.code === 2000) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

//删除 “摄像头套餐”
export async function delCamera (data) {
  const res = await request.post('/business/cameraPackage/delete', data)
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}
